package com.lhl.log.autoconfigure;

import com.lhl.log.autoconfigure.support.LogContext;
import com.lhl.log.autoconfigure.support.LogProcessor;
import com.lhl.log.core.VoidLogCallback;
import com.lhl.log.formatter.DefaultParamFormatter;
import com.lhl.log.formatter.DefaultResultFormatter;
import org.slf4j.Logger;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;

/**
 * @className: LogAutoConfiguration
 * @description: 日志自动装配
 * @author: king
 * @date: 2020-09-16 11:04
 **/
@Configuration
@EnableConfigurationProperties(Slf4jProperties.class)
@ConditionalOnClass({Logger.class})
@Import({
        LogContext.class,
        DefaultParamFormatter.class,
        DefaultResultFormatter.class,
        VoidLogCallback.class
})
public class LogAutoConfiguration {

    @Bean
    public LogProcessor logProcessor() {
        return new LogProcessor();
    }
}